/**
 * Copyright (C) 2010 Cloudfarming <info@cloudfarming.nl>
 *
 * Licensed under the Eclipse Public License - v 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.eclipse.org/legal/epl-v10.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package nl.cloudfarming.client.sensor.cropcircle;

/**
 *  enum for defining fields in the crop circle files
 *  contains 'start' 'end' positions, mandatory length, mandatory and dat type
 *  the mandatory lenght is introduced due to the fact that fields could be negative and have a extra minus "-" character
 *  @author Merijn Zengers
 */


public enum CropcircleASC340FileDescription {
        /* Longitude of measured cropcircle coordinate */
	LONGITUDE(0,12,true,java.lang.Double.class), //12 0003.8513480
	
        /* Latitude of measured cropcircle coordinate */
        LATITUDE(1,12,true,java.lang.Double.class), //12 0051.5193244
        
        /*  */
	FIX_TYPE(2,1,true,java.lang.Integer.class), //1 4
        
        /* UTC Standard time */
	UTC_TIME(3,9,true,java.util.Date.class), //9 042352.06
              
        /* Speed of vehicle at the moment this coordinate is measured. Unit? KM/h? Miles/h? */
	SPEED(4,3,true,java.lang.Double.class), //3 0.0
        
        /* Coure of the sensor */
	COURSE(5,5,true,java.lang.Double.class), //5 175.8
        
        /* Number of the sensor. (It is possible that more then one sensor is active at the same time.) */
	SENSOR(5,1,true,java.lang.Double.class), //1 1
        
        /* Vegetation Index calculated with the formula: (R2-R1)/(R2+R1) Rounded on 3 decimals. */
	VI1(7,5,true,java.lang.Double.class), //6  0.000
        
        /* Vegetation Index calculated with the formula: (R2-R3)/(R2+R3) Rounded on 3 decimals. */
	VI2(8,5,true,java.lang.Double.class), //7 999.000
        
        /* Reflection measurement, done on a wavelength of 670nm */
	R1(9,5,true,java.lang.Double.class), //8 999.0000
        
        /* Reflection measurement, done on a wavelength of 730nm */
	R2(10,5,true,java.lang.Double.class), //8 999.0000
        
        /* Reflection measurement, done on a wavelength of 780nm */
	R3(11,5,true,java.lang.Double.class), //8 999.0000
        
        /**/
	APP_RATE(12,1,false,java.lang.String.class); //1

	private final int position;
        private final int mandatoryLength;
	private final boolean mandatory;
	private final static String delimiter = ",";
        private final Class theClass;
	
	private CropcircleASC340FileDescription(int position, int mandatoryLength, boolean mandatory, Class theClass ){
		this.position = position;
		this.mandatory = mandatory;
                this.mandatoryLength = mandatoryLength;
                this.theClass = theClass;
	}
	
	public static String getDelimiter() {
		return delimiter;
	}

	public int getPosition() {
		return position;
	}

	public boolean isMandatory() {
		return mandatory;
	}

        public int getMandatoryLength() {
            return mandatoryLength;
        }

        public Class getTheClass() {
            return theClass;
        }	
}
